package com.zhoutao.blog.seven.api;

import com.zhoutao.blog.seven.model.Response;
import com.zhoutao.blog.seven.service.CacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/cache")
public class CacheController {

    @Autowired
    private CacheService cacheService;

    @GetMapping("/clean")
    public Response<String> cleanCache() {
        cacheService.clean();
        Response<String> response = new Response<>();
        response.setCode(1);
        response.setMsg("服务端清理缓存成功");
        return response;
    }

}
